//
//  SISSHouseTypeCell.m
//  SISSAPP
//
//  Created by 袁应荣 on 2018/10/19.
//  Copyright © 2018年 优房网. All rights reserved.
//

#import "SISSHouseTypeCell.h"

@interface SISSHouseTypeCell ()

///
@property (weak, nonatomic) UIImageView *houseTypeImageView;
@property (weak, nonatomic) UILabel *houseNumLabel;
@property (weak, nonatomic) UILabel *rightTagLabel;
@property (weak, nonatomic) UILabel *middleLabel;
@property (weak, nonatomic) UILabel *bottomLabel;
@property (weak, nonatomic) UIView  *bottomLine;

@end
@implementation SISSHouseTypeCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)initUI {
    [super initUI];
    
    UIImageView *houseTypeImageView = [[UIImageView alloc] init];
    houseTypeImageView.image = [UIImage imageNamed:@"空白"];
    [self.contentView addSubview:houseTypeImageView];
    self.houseTypeImageView = houseTypeImageView;
    
    UILabel *houseNumLabel = [UILabel yyr_labelWithText:@"楼层门牌号：2002" fontSize:15 textColor:MAIN_TEXT_COLOR];
    [self.contentView addSubview:houseNumLabel];
    self.houseNumLabel = houseNumLabel;
    
    UILabel *rightTagLabel = [UILabel yyr_labelWithText:@"售罄" fontSize:15 textColor:UIColor.redColor];
    [self.contentView addSubview:rightTagLabel];
    self.rightTagLabel = rightTagLabel;
    
    UILabel *middleLabel = [UILabel yyr_labelWithText:@"3室2厅2卫 建面 89m²（北朝向）" fontSize:15 textColor:MAIN_TEXT_COLOR];
    [self.contentView addSubview:middleLabel];
    self.middleLabel = middleLabel;
    
    UILabel *bottomLabel = [UILabel yyr_labelWithText:@"单价：48000元/㎡   总价：4800 000元" fontSize:15 textColor:MAIN_TEXT_COLOR ];
    [self.contentView addSubview:bottomLabel];
    self.bottomLabel = bottomLabel;
    
    UIView *bottomLine = [[UIView alloc] init];
    bottomLine.backgroundColor = [UIColor groupTableViewBackgroundColor];
    [self.contentView addSubview:bottomLine];
    self.bottomLine = bottomLine;
}

- (void)initConstraint {
    [super initConstraint];
    
    WeakSelf
    CGSize imageSize = CGSizeMake(80, 60);
    [self.houseTypeImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(weakSelf.contentView).offset(2 * globelMargin);
        make.top.equalTo(weakSelf.contentView).offset(5 * globelMargin);
        make.size.mas_equalTo(imageSize);
    }];
    
    [self.houseNumLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(weakSelf.houseTypeImageView.mas_right).offset(globelMargin);
        make.top.equalTo(weakSelf.houseTypeImageView).offset(-globelMargin);
    }];
    
    [self.rightTagLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(weakSelf.houseNumLabel);
        make.right.equalTo(weakSelf.contentView).offset(-2 * globelMargin);
    }];

    [self.middleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(weakSelf.houseNumLabel);
        make.top.equalTo(weakSelf.houseNumLabel.mas_bottom).offset(2 * globelMargin);
    }];
    
    [self.bottomLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(weakSelf.middleLabel);
        make.top.equalTo(weakSelf.middleLabel.mas_bottom).offset(2 * globelMargin);
    }];
    
    [self.bottomLine mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(weakSelf.bottomLabel.mas_bottom).offset(2 * globelMargin);
        make.left.bottom.right.equalTo(weakSelf.contentView);
        make.height.mas_equalTo(1);
    }];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
